﻿/****** First draft for table schemas. Date: 06/04/2009 01:44:00 ******/

USE [one4all]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[StreamItemType](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[name] [nvarchar](50) NOT NULL,
	[description] [nvarchar](150) NULL,
 CONSTRAINT [PK_StreamItemType] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CREATE TABLE [dbo].[StreamItems](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[title] [nvarchar](50) NOT NULL,
	[text] [nvarchar](500) NOT NULL,
	[link] [nchar](200) NULL,
	[date] [datetime] NOT NULL,
	[type] [int] NOT NULL,
 CONSTRAINT [PK_StreamItem] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[StreamItems]  WITH CHECK ADD  CONSTRAINT [FK_StreamItem_StreamItemType] FOREIGN KEY([type])
REFERENCES [dbo].[StreamItemType] ([id])
GO

ALTER TABLE [dbo].[StreamItems] CHECK CONSTRAINT [FK_StreamItem_StreamItemType]
GO

